package com.cy;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.annotation.ApplicationScope;

import javax.print.DocFlavor;

@SpringBootApplication
public class ScaProviderApplication {
    public static void main(String[] args) {

        SpringApplication.run(ScaProviderApplication.class,args);
    }
    @Value("${server.port}")
    private String server;
    @RefreshScope
    @RestController
    public class providerController{
        @Value("${logging.level.com.cy:error}")

        private String LogLevel;

        @Value("${server.tomcat.threads.max:200}")
        private String maxThread;

        @Value("${page.pageSize:10}")
        private Integer pageSize;

        @GetMapping("/provider/doGetPageSize")
        public String doGetPageSize(){
            return "page size is" + pageSize;
        }



        @GetMapping("/provider/doGetMaxThread")
        public String doGetMaxThread(){
            return "tomcat max thread is "+maxThread;
        }




        @GetMapping("doGetLogLevel")
        public String doGetLogLevel(){
            return "log level is"+LogLevel;
        }

        @GetMapping("/provider/echo/{msg}")
        public String deEcho(@PathVariable String msg){
            return server+"say hello"+msg;
        }
    }



}
